package descentFly.app.dialogs
{
	import UIUtils.uif_util;
	
	import descentFly.app.df_block;
	import descentFly.app.df_component;
	import descentFly.app.df_label;
	import descentFly.app.df_modalLayer;
	import descentFly.app.df_window;
	
	import flash.geom.Rectangle;
	
	public class df_alert extends df_window {
		public static var WIDTH: int = 400;
		public static var CTRLSHEIGHT : int = 130;
		private var _description: df_label;
		public function df_alert(a_parent: df_modalLayer, message: String, styleClass: Object='window', canClose: int = 1) {
			var style : Object = a_parent.app.styleByObj(styleClass);
			var height: int = uif_util.calcTextHeight(message, WIDTH - a_parent.app.getStyleSpace(style, true) * 2, style.description);
			super(a_parent, WIDTH, height + CTRLSHEIGHT, styleClass, true, canClose);
			_description.text = message;
			title.text = locale.ALERTTITLE;
		}
		
		override protected function createDialogComponents(a_layer:df_block):void {
			super.createDialogComponents(a_layer);
			var inner: Rectangle = a_layer.getInner();
			_description = new df_label(a_layer, inner.x, inner.y, inner.width, inner.height, style.description);
		}
		
		override protected function createButtons(a_layer:df_block):void {
			addButton(locale.OK, doButtonClose);
		}
	}
}